package com.wawayaya.bean;

import org.json.JSONObject;

/**
 * Created by creative on 15/7/3.
 */
public class MyBookShelf implements Cloneable{

    private  Integer  uId;
    private  Integer  bookId;
    private  String   createDate;
    private  String   lastModifyDate;
    private  Integer  saleFlag;
    private  Integer  bsId;
    private  String   parts;

    /**
     * 增加 saleFlag、增加所属书架 bsId
     */

    public MyBookShelf() {

    }

    public Object clone() {
        MyBookShelf o = null;
        try {
            o = (MyBookShelf) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return o;
    }


    public MyBookShelf(Integer uId, Integer bookId, String createDate,
                       String lastModifyDate, Integer saleFlag, Integer bsId, String parts) {
        this.uId = uId;
        this.bookId = bookId;
        this.createDate = createDate;
        this.lastModifyDate = lastModifyDate;
        this.saleFlag = saleFlag;
        this.bsId = bsId;
        this.parts = parts;
    }

    public MyBookShelf(Integer uId, Integer bookId,
                       String createDate, String lastModifyDate,
                       Integer saleFlag,Integer  bsId) {
        this.uId = uId;
        this.bookId = bookId;
        this.createDate = createDate;
        this.lastModifyDate = lastModifyDate;
        this.saleFlag  =  saleFlag;
        this.bsId = bsId;
    }


    public Integer getuId() {
        return uId;
    }

    public void setuId(Integer uId) {
        this.uId = uId;
    }

    public Integer getBookId() {
        return bookId;
    }

    public void setBookId(Integer bookId) {
        this.bookId = bookId;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    public String getLastModifyDate() {
        return lastModifyDate;
    }

    public void setLastModifyDate(String lastModifyDate) {
        this.lastModifyDate = lastModifyDate;
    }

    public Integer getSaleFlag() {
        return saleFlag;
    }

    public void setSaleFlag(Integer saleFlag) {
        this.saleFlag = saleFlag;
    }

    public Integer getBsId() {
        return bsId;
    }

    public void setBsId(Integer bsId) {
        this.bsId = bsId;
    }

    public String getParts() {
        return parts;
    }

    public void setParts(String parts) {
        this.parts = parts;
    }

    @Override
    public String toString() {
        return "MyBookShelf{" +
                "uId=" + uId +
                ", bookId=" + bookId +
                ", createDate='" + createDate + '\'' +
                ", lastModifyDate='" + lastModifyDate + '\'' +
                '}';
    }

    public  MyBookShelf  jsonToVO(JSONObject json){
        setuId(json.optInt("userId"));
        setBookId(json.optInt("bookId"));
        setCreateDate(json.optString("createDate"));
        setLastModifyDate(json.optString("lastModifyDate"));
        setBsId(json.optInt("bsId"));
        return this;
    }
}
